package com.casic.ops.entity.vo.pipeline;

import com.casic.ops.consts.app.StageType;
import com.casic.ops.entity.domain.ApplicationPipelineDetailDO;
import com.casic.ops.entity.domain.pipeline.PipelineNodeLoggerDO;
import com.casic.ops.entity.dto.pipeline.datastructure.graph.Nodes;
import com.casic.ops.entity.vo.ApplicationPipelineStatisticsDetailVO;
import lombok.Data;

@Data
public class PipelineStaticsNodeDetailVO {
    /**
     * id
     */
    private String nodeUuid;

    /**
     * 应用名称
     */
    private String nodeName;

    /**
     * 阶段类型 10构建 20发布
     *
     * @see StageType
     */
    private Integer stageType;

    /**
     * 平均操作时长ms (成功)
     */
    private Long avgUsed;

    /**
     * 平均操作时长 (成功)
     */
    private String avgUsedInterval;


    public static PipelineStaticsNodeDetailVO Nodes2pipelineStatisticsNodeDetailVO(Nodes p) {
        PipelineStaticsNodeDetailVO vo=new PipelineStaticsNodeDetailVO();
        vo.setNodeUuid(p.getId());
        vo.setNodeName(p.getNodeName());
        vo.setStageType((10));
        return vo;
    }

    @Override
    public String toString() {
        return "PipelineStaticsNodeDetailVO{" +
                "id=" + nodeUuid +
                ", nodeName='" + nodeName + '\'' +
                ", stageType=" + stageType +
                ", avgUsed=" + avgUsed +
                ", avgUsedInterval='" + avgUsedInterval + '\'' +
                '}';
    }
}
